import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('你好Flutter')),
        body: const Row(children: [MyApp(), MyButton(), MyText()]),
      ),
    ),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        alignment: Alignment.center,
        width: 200,
        height: 200,
        decoration: BoxDecoration(
          color: Colors.yellow, // 背景色
          border: Border.all(color: Colors.red, width: 2), // 配置边框
          borderRadius: BorderRadius.circular(10), // 配置圆角
          boxShadow: const [
            BoxShadow(color: Colors.blue, blurRadius: 10),
          ], // 配置阴影
          gradient: const LinearGradient(
            // 配置渐变
            colors: [Colors.red, Colors.orange, Colors.yellow],
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
          ),
        ),
        child: const Text(
          'Hello Flutter',
          style: TextStyle(fontSize: 20, color: Colors.black),
        ),
      ),
    );
  }
}

class MyButton extends StatelessWidget {
  const MyButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      width: 200,
      height: 40,
      margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
      padding: const EdgeInsets.all(10),
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(20),
      ),
      child: const Text(
        '按钮',
        style: TextStyle(fontSize: 14, color: Colors.white),
      ),
    );
  }
}

class MyText extends StatelessWidget {
  const MyText({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 200,
      height: 200,
      margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
      //decoration: BoxDecoration(color: Colors.yellow),
      color: Colors.yellow,
      child: const Text(
        '你好我是Flutter你好我是Flutter你好我是Flutter你好我是Flutter你好我是Flutter你好我是Flutter',
        textAlign: TextAlign.left,
        maxLines: 2,
        overflow: TextOverflow.ellipsis,
        style: TextStyle(
          fontSize: 20,
          fontWeight: FontWeight.bold, // 加粗
          color: Colors.red,
          fontStyle: FontStyle.italic, // 斜体
          letterSpacing: 5, // 字间距
          decoration: TextDecoration.underline, // 下划线
          decorationColor: Colors.blue, // 下划线颜色
          decorationStyle: TextDecorationStyle.dashed, // 虚线
        ),
      ),
    );
  }
}
